package packagename.states
{
	// FLASH
	import flash.display.Shape;
	
	// HIVE
	import org.hive.managers.plugin.LayoutManager;
	import org.hive.managers.StateManager;
	import org.hive.state.*;
	import org.hive.sequence.*;
	
	// PROJECTNAME
	import packagename.states.*;
		
	public class ProjectNameCircleState extends State implements IState
	{
		private var redCircle	:Shape;
		
		public override function create():ActionSequence
		{
			//________________________________________________________________________ ASSETS
			redCircle = new Shape();
			redCircle.graphics.beginFill(0xff2200);
			redCircle.graphics.drawCircle(0, 0, 100);
			redCircle.x = 400;
			redCircle.y = 200;
			redCircle.alpha = 0;
			
			//________________________________________________________________________ SEQUENCE
			var createSequence:ActionSequence = new ActionSequence( "CircleState::createSequence" );
			createSequence.push( { scope:redCircle, alpha:1, time:1 } );
			createSequence.push( new SequenceDelay(1000) );
			createSequence.push( { scope:redCircle, x:600, time:2 } );
			createSequence.push( new SequenceDelay(2000) );
			createSequence.push( new SequenceFunction(StateManager, StateManager.switchState, new ProjectNameHelloWorldState() ) );
			
			return createSequence;
		}

		private function kill():void
		{
			LayoutManager.removeChild( redCircle );
		}
		
		public override function close():CloseSequence
		{
			var closeSequence:CloseSequence = new CloseSequence( "CircleState::closeSequence" );
			
			closeSequence.push( {scope:redCircle, alpha:0, time:1} );
			closeSequence.push( new SequenceFunction(this, kill) );
			
			return closeSequence;
		}
		
	}
	
}
